package com.anhry.app.safety.manage.oa.bean;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.anhry.app.safety.manage.system.bean.TbUser;

/**
 * TbOaMsg generated by MyEclipse Persistence Tools
 */
@Entity
@Table(name = "TB_OA_MSG")
@SequenceGenerator(name="TB_OA_MSG_SEQ", sequenceName="TB_OA_MSG_SEQ", allocationSize=1)
public class TbOaMsg implements java.io.Serializable {

	// Fields

	private Long id;

	private String msgTitle; //标题

	private String msgContext; //内容

	private Date msgTime; //时间

//	private Long msgUser; //用户
	private TbUser tbUser;

	private Long msgGrade; //级别

	private Long msgUnit; //单位

	private Long msgDept; //部门

	private String acceptStatus; //采纳状态 0，未采纳  否则为采纳类型id

	private String editStatus; //编辑状态 0，未提交 可编辑 1，已提交 不可编辑

	private String isDele;
	
	private String readStatus; //阅读状态 0，未读 1，已读
	
	private String acceptName; // 采纳类型名字

	private Set<TbOaMsgFj> tbOaMsgFjs = new HashSet<TbOaMsgFj>(0);

	// Constructors

	/** default constructor */
	public TbOaMsg() {
	}

	/** minimal constructor */
	public TbOaMsg(Long id) {
		this.id = id;
	}

	/** full constructor */
	public TbOaMsg(Long id, String msgTitle, String msgContext, Date msgTime, TbUser tbUser, Long msgGrade, Long msgUnit, Long msgDept, String acceptStatus, String editStatus, String isDele, Set<TbOaMsgFj> tbOaMsgFjs, String readStatus, String acceptName) {
		this.id = id;
		this.msgTitle = msgTitle;
		this.msgContext = msgContext;
		this.msgTime = msgTime;
//		this.msgUser = msgUser;
		this.tbUser = tbUser;
		this.msgGrade = msgGrade;
		this.msgUnit = msgUnit;
		this.msgDept = msgDept;
		this.acceptStatus = acceptStatus;
		this.editStatus = editStatus;
		this.isDele = isDele;
		this.tbOaMsgFjs = tbOaMsgFjs;
		this.readStatus = readStatus;
		this.acceptName = acceptName;
	}

	// Property accessors
	@Id
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, precision = 11, scale = 0)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TB_OA_MSG_SEQ")
	public Long getId() {
		return this.id;
	}

	@Column(name = "ACCEPT_NAME", unique = false, nullable = true, insertable = true, updatable = true)
	public String getAcceptName() {
		return acceptName;
	}

	public void setAcceptName(String acceptName) {
		this.acceptName = acceptName;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "MSG_TITLE", unique = false, nullable = true, insertable = true, updatable = true)
	public String getMsgTitle() {
		return this.msgTitle;
	}

	public void setMsgTitle(String msgTitle) {
		this.msgTitle = msgTitle;
	}

	@Column(name = "MSG_CONTEXT", unique = false, nullable = true, insertable = true, updatable = true)
	public String getMsgContext() {
		return this.msgContext;
	}

	public void setMsgContext(String msgContext) {
		this.msgContext = msgContext;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "MSG_TIME", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public Date getMsgTime() {
		return this.msgTime;
	}

	public void setMsgTime(Date msgTime) {
		this.msgTime = msgTime;
	}

	@ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.EAGER)
	@JoinColumn(name="MSG_USER")
	public TbUser getTbUser() {
		return tbUser;
	}

	public void setTbUser(TbUser tbUser) {
		this.tbUser = tbUser;
	}

	@Column(name = "MSG_GRADE", unique = false, nullable = true, insertable = true, updatable = true, precision = 11, scale = 0)
	public Long getMsgGrade() {
		return this.msgGrade;
	}

	public void setMsgGrade(Long msgGrade) {
		this.msgGrade = msgGrade;
	}

	@Column(name = "MSG_UNIT", unique = false, nullable = true, insertable = true, updatable = true, precision = 11, scale = 0)
	public Long getMsgUnit() {
		return this.msgUnit;
	}

	public void setMsgUnit(Long msgUnit) {
		this.msgUnit = msgUnit;
	}

	@Column(name = "MSG_DEPT", unique = false, nullable = true, insertable = true, updatable = true, precision = 11, scale = 0)
	public Long getMsgDept() {
		return this.msgDept;
	}

	public void setMsgDept(Long msgDept) {
		this.msgDept = msgDept;
	}

	@Column(name = "ACCEPT_STATUS", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public String getAcceptStatus() {
		return this.acceptStatus;
	}

	public void setAcceptStatus(String acceptStatus) {
		this.acceptStatus = acceptStatus;
	}

	@Column(name = "EDIT_STATUS", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public String getEditStatus() {
		return this.editStatus;
	}

	public void setEditStatus(String editStatus) {
		this.editStatus = editStatus;
	}

	@Column(name = "IS_DELE", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public String getIsDele() {
		return this.isDele;
	}

	public void setIsDele(String isDele) {
		this.isDele = isDele;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "tbOaMsg")
	public Set<TbOaMsgFj> getTbOaMsgFjs() {
		return this.tbOaMsgFjs;
	}

	public void setTbOaMsgFjs(Set<TbOaMsgFj> tbOaMsgFjs) {
		this.tbOaMsgFjs = tbOaMsgFjs;
	}

	@Column(name = "READ_STATUS", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public String getReadStatus() {
		return readStatus;
	}

	public void setReadStatus(String readStatus) {
		this.readStatus = readStatus;
	}

}